<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			table{
				height: 200px;
				width: 300px;
			}
			.zi{
				background: #333399;
			}
			.lan{
				background: #ccccff;
			}
		</style>
	</head>
	<body>
		<div>罗全辉</div>
		<table border="1" cellspacing="0" cellpadding="0" class="kk">
			<tr>
				<td>姓名</td>
				<td>工资</td>
				<td>入职时间</td>
				<td>操作</td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<tr>
				<td>Tom</td>
				<td>$3500</td>
				<td>2010-10-15</td>
				<td><a href="javascript:void(0)" onclick="del(this)">删除</a></td>
			</tr>
			<script>
				var s=document.getElementsByTagName('tr');
				console.log(s.length);
				
			function color(){
				for(var i=0;i<s.length;i++){
					s[i].className='';
					
					s[0].className='zi';
					
					if(i%2!==0){
						s[i].className='lan';
					}
				}
			}	
			color();
				function del(obj){
					var desk=obj.parentNode.parentNode;
					
					var f=obj.parentNode.parentNode.parentNode;
					f.removeChild(desk);
					color();
					
				}
			</script>
		</table>
	</body>
</html>
